package com.szsh.aiot.hsm.dto.camera;


import com.szsh.aiot.common.utils.TimeTools;

import java.util.ArrayList;
import java.util.List;

public class PictureDataModel {
    private List<List<String>> datalist;
    private List<List<String>> alarmlist;
    private String time;

    public List<List<String>> getAlarmlist() {
        return alarmlist;
    }

    public void setAlarmlist(List<List<Object>> alarmlist) {
        List<List<String>> translate = translate(alarmlist);
        this.alarmlist = translate;
    }

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }

    public List<List<String>> getDatalist() {
        return datalist;
    }

    public void setDatalist(List<List<Object>> datalist) {
        List<List<String>> translate = translate(datalist);
        this.datalist = translate;
    }

    public static PictureDataModel returnSuccess() {
        PictureDataModel model = new PictureDataModel();
        model.setTime(TimeTools.date2String(TimeTools.getNow(), "yyyy-MM-dd HH:mm"));
        return model;
    }

    public static PictureDataModel returnFail() {
        PictureDataModel model = new PictureDataModel();
        return model;
    }
    public List<List<String>> translate(List<List<Object>> object2List){
        List<List<String>> string2List =  new ArrayList<List<String>>();
        for (List<Object> objectList : object2List) {
            List<String> arrayList = new ArrayList<>();
            String str = (String) objectList.get(0);
            int intValue = Double.valueOf(String.valueOf(objectList.get(1))).intValue();
            arrayList.add(0,str);
            arrayList.add(1, String.valueOf(intValue));
            string2List.add(arrayList);
        }
        return string2List;
    }
}
